using System;
using System.Collections;
using System.Collections.Generic;
using System.ServiceModel;
using ArithCollect;
using System.Text;
using Test.ServiceReference1;

namespace Test{
   public class ProxyService1{
       static ProxyService1 _deputy;
       public static ProxyService1 Deputy {
           get { if (_deputy == null)_deputy = new ProxyService1(); return _deputy; }
     }
     Service1Client cc;
       ProxyService1(){
           cc=new Service1Client(/* wcf client binding name*/);
           cc.WelcomeCompleted+=cc_WelcomeCompleted;
           cc.AddCompleted+=cc_AddCompleted;
           cc.MultiplyCompleted+=cc_MultiplyCompleted;
           cc.SubtractCompleted+=cc_SubtractCompleted;
           cc.DivisionCompleted+=cc_DivisionCompleted;
     }
       void cc_WelcomeCompleted(object sender, WelcomeCompletedEventArgs e) {
         try {Acex.WcfRpcCallback(e.Result,"Welcome");}
         catch (Exception ex) {Acex.WcfRpcError(ex);}
     }
       void cc_AddCompleted(object sender, AddCompletedEventArgs e) {
         try {Acex.WcfRpcCallback(e.Result,"Add");}
         catch (Exception ex) {Acex.WcfRpcError(ex);}
     }
       void cc_MultiplyCompleted(object sender, MultiplyCompletedEventArgs e) {
         try {Acex.WcfRpcCallback(e.Result,"Multiply");}
         catch (Exception ex) {Acex.WcfRpcError(ex);}
     }
       void cc_SubtractCompleted(object sender, SubtractCompletedEventArgs e) {
         try {Acex.WcfRpcCallback(e.Result,"Subtract");}
         catch (Exception ex) {Acex.WcfRpcError(ex);}
     }
       void cc_DivisionCompleted(object sender, DivisionCompletedEventArgs e) {
         try {Acex.WcfRpcCallback(e.Result,"Division");}
         catch (Exception ex) {Acex.WcfRpcError(ex);}
     }
       public String Welcome(){
           cc.WelcomeAsync();
         return default(String);
     }
       public Int32 Add(System.Int32 a,System.Int32 b){
           cc.AddAsync(a,b);
         return default(Int32);
     }
       public Int32 Multiply(System.Int32 a,System.Int32 b){
           cc.MultiplyAsync(a,b);
         return default(Int32);
     }
       public Int32 Subtract(System.Int32 a,System.Int32 b){
           cc.SubtractAsync(a,b);
         return default(Int32);
     }
       public Double Division(System.Int32 a,System.Int32 b){
           cc.DivisionAsync(a,b);
         return default(Double);
     }
 }
}
